gh-106320: Remove private _PyType_Lookup() function#108600
gh-106320: Remove private _PyType_Lookup() function#108600vstinner wants to merge 1 commit intopython:mainfrom
Conversation
Move the private function to the internal C API (pycore_object.h).
|
@serhiy-storchaka: I vaguely recall that you considered to expose a similar API to the public C API. Is it still the case? Or what is the PyObject_GetOptionalAttr() API that you added to Python 3.13? |
|
_PyType_Lookup() is mentioned in Python code "Emulate _PyType_Lookup() in Objects/typeobject.c" at: https://docs.python.org/dev/howto/descriptor.html#invocation-from-an-instance _PyType_Lookup() was mentioned in: |
|
No, I did not work with Perhaps we should first add a public and better designed variants of |
Results of a code search on PyPI top 5,000 projects (2023-07-04). Affected projects (20):
|
If a private function is widely used and it makes sense to expose it to the public C API, sure, go ahead.
Which aspects of the API you would like to change in _PyType_Lookup()? |
First of all, it contains If it start returning an error, there are variants of the interface: return a pointer with the following calling of Then you may want to return a new reference, although I am not sure that there is a problem with a borrowing reference here. But we should investigate. It may be turn out that |
|
I close my issue. I prefer to keep Well, apparently, it's still interesting to consider adding a public flavor of this API. |
Move the private function to the internal C API (pycore_object.h).